import React, { Component } from 'react'
import './App.css'
import Header from './components/Header/Header'
import List from './components/List/List'
import Footer from './components/Footer/Footer'
import { useEffect } from 'react'
import { useDispatch } from 'react-redux'
import { asyncGetTodos } from './store/slice/todos'
export default function App() {
    const dispatch = useDispatch()
    // 组件加载后执行，请求服务器，初始化redux的todos
    useEffect(() => {
        dispatch(asyncGetTodos())
    }, [])
    return (
        <div className="todo-container">
            <div className="todo-wrap">
                <Header />
                <List />
                <Footer />
            </div>
        </div>
    )
}
